package com.dayang.controllor;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import net.sf.json.JSONObject;

import org.apache.shiro.authc.IncorrectCredentialsException;
import org.apache.shiro.authc.UnknownAccountException;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.dayang.common.user.UserRequest;
import com.dayang.model.Userif;
import com.dayang.service.OAuthService;


@RestController
@RequestMapping("/user")
public class UserController {
	
	@Resource 
	private OAuthService oAuthService; 
	
	
	@RequestMapping(value = "/getuserinfo",method = RequestMethod.GET)
    public Userif showLoginForm(HttpSession session, @RequestBody String parameters) {
		JSONObject parametersObj = JSONObject.fromObject(parameters);
		UserRequest  request =	(UserRequest) JSONObject.toBean(parametersObj, UserRequest.class);
		if(oAuthService.checkAccessToken(request.getAccess_token())){
		
		}else{
			
			
		}
       Userif u = new Userif();
       u.setId(Long.valueOf("1242143543634634654"));
		u.setUsername("001");
		u.setPassword("23432432432432423423");;
       return u;
    }

}
